How to use the elm.Background function in elm

To help you get started, we’ve selected a few elm examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kakaroto / e17 / PROTO / elev8 / data / javascript / clock.js View on Github external
var elm = require('elm')

var EXPAND_BOTH = { x: 1.0, y: 1.0 };
var FILL_BOTH = { x: -1.0, y: -1.0 };

var EDIT_HOUR = 2; //constants required by elementary - why should I expose this?
var EDIT_MINUTE = 8; // constants required by elementary - why should I expose this?
var EDIT_SECOND = 32; // constants required by elementary - why should I expose this?

var w = elm.Window({
    title: "Clock Demo",
    width: 320,
    height: 480,
    align: FILL_BOTH,
    elements: {
        the_background: elm.Background({
            weight: EXPAND_BOTH,
            align: FILL_BOTH,
            resize: true,
        }),
        the_box: elm.Box({
            weight: EXPAND_BOTH,
            resize: true,
            elements: {
                the_clock: elm.Clock({
                    show_am_pm: 1,
                    show_seconds: 1,
                    hour: 23,
                    minute: 45,
                    second: 34,
                    edit: true,
                    digit_edit: EDIT_HOUR | EDIT_MINUTE | EDIT_SECOND,
github kakaroto / e17 / PROTO / elev8 / data / javascript / anim.js View on Github external
}

function bubble(n) {
    return sprite(n, 'bb');
}

function shadow(n) {
    return sprite(n, 'sh');
}

var win = elm.realise(elm.Window({
    label: "Animation demo",
    width: 480,
    height: 800,
    elements: {
        the_background: elm.Background({
            weight: EXPAND_BOTH,
            image: elm.datadir + "data/images/rock_01.jpg",
            resize: true
        }),
        shadow1: shadow(0),
        shadow2: shadow(1),
        shadow3: shadow(2),
        bubble1: bubble(0),
        bubble2: bubble(1),
        bubble3: bubble(2)
    },
    on_keydown: function () {
        print(this.label);
        elm.exit();
    }
}));
github shr-project / enlightenment / PROTO / elev8 / data / javascript / slider.js View on Github external
*/

var elm = require('elm');

var EXPAND_BOTH = { x: 1.0, y: 1.0 };

var logo_icon = elm.Icon({
    image: elm.datadir + "data/images/logo_small.png",
});

var w = elm.Window({
    title: "Slider",
    width: 320,
    height: 480,
    elements: {
        the_background: elm.Background({
            resize: true,
            weight: EXPAND_BOTH
        }),
        the_box: elm.Box({
            weight: EXPAND_BOTH,
            resize: true,
            elements: {
                horz_slider: elm.Slider({
                    label: "Horizontal",
                    units: "%1.1f units",
                    span: 120,
                    align: { x: -1.0, y: 0.5 },
                    weight: EXPAND_BOTH,
                    icon: logo_icon,
                    on_change: function(me) {
                        e.elements.the_box.elements.box2.elements.vert_inverted.value = me.value
github kakaroto / e17 / PROTO / elev8 / data / javascript / naviframe.js View on Github external
on_delete: function() { print('Deleting ', this.title) },
        content: {
            "Orange": orange,
            "Yellow": yellow,
            "Green": green
        }[this.label] || orange,
        title: this.label
    };
}

win = elm.realise(elm.Window({
    title: "Naviframe Example",
    width: 320,
    height: 480,
    elements: {
        background: elm.Background({
            weight: EXPAND_BOTH,
            align: FILL_BOTH,
            resize: true
        }),
        box: elm.Box({
            weight: EXPAND_BOTH,
            align: FILL_BOTH,
            resize: true,
            elements: {
                naviframe: elm.Naviframe({
                    weight: EXPAND_BOTH,
                    align: FILL_BOTH,
                    elements: {},
                    resize: true
                }),
                but_box: elm.Box({
github kakaroto / e17 / PROTO / elev8 / data / javascript / panes.js View on Github external
elm = require('elm');

var EXPAND_BOTH = { x: 1.0, y: 1.0 };
var FILL_BOTH = { x: -1.0, y: -1.0 };

var logo_icon = elm.Icon({
    image: elm.datadir + "data/images/logo_small.png"
});

elm.realise(elm.Window({
    title: "Panes Demo",
    width: 320,
    height: 480,
    align: FILL_BOTH,
    elements: {
        background: elm.Background({
            weight: EXPAND_BOTH,
            align: FILL_BOTH,
            resize: true,
        }),
        pane_1: elm.Pane({
            weight: EXPAND_BOTH,
            resize: true,
            fill: true,
            left: elm.Button({
                icon: logo_icon,
                label: "Left",
                weight: { x: -1.0, y: -1.0 },
                on_click: function(arg) {
                    print("clicked event on Button: Left");
                },
                on_unpress: function(arg) {
github kakaroto / e17 / PROTO / elev8 / data / javascript / airshow.js View on Github external
my_win.elements.plane2.on_animate = null;
    my_win.elements.plane3.on_animate = null;
    my_win.elements.plane4.on_animate = null;

    make_alien_population();

}

var my_win = elm.realise(elm.Window({
        title : "Air Show",
        width : 800,
        height : 600,
        weight : EXPAND_BOTH,
        align : FILL_BOTH,
        elements : {
            the_background : elm.Background ({
                weight : EXPAND_BOTH,
                align : FILL_BOTH,
                image : elm.datadir + "data/images/space.png",
                resize : true,
            }),
            plane1 : elm.Image ({
                file : elm.datadir + "data/images/plane1.png",
                width : 50,
                height : 70,
                x : 350,
                y : 100,
                on_click : function() {
                    if(myplane==null)
                    {
                        print(this.height + " " + this.weight);
                        myplane = my_win.elements.plane1 ;
github shr-project / enlightenment / PROTO / elev8 / data / javascript / notify.js View on Github external
text: entry_text,
    weight: EXPAND_BOTH,
    align: FILL_BOTH,
    line_wrap: 3,
    single_line: 1,
    editable: true
});

var win = elm.realise(elm.Window({
    title: "Notify Example",
    width: 320,
    height: 480,
    weight: EXPAND_BOTH,
    align: FILL_BOTH,
    elements: {
        background: elm.Background({
            weight: EXPAND_BOTH,
            align: FILL_BOTH,
            resize: true
        }),
        box: elm.Box({
            weight: EXPAND_BOTH,
            align: FILL_BOTH,
            resize: true,
            elements: {
                notify: elm.Notify({
                    content: entry,
                    timeout: 5,
                    align: { x: 0.5, y: 0.0 }
                }),
                icon_no_scale: elm.Button({
                    label: "Icon no scale",
github kakaroto / e17 / PROTO / elev8 / data / javascript / spinner.js View on Github external
var elm = require('elm');

var EXPAND_BOTH = { x: 1.0, y: 1.0 };
var FILL_BOTH = { x: -1.0, y: -1.0 };
var FILL_X = { x: -1.0, y: 0.5 };

var w = elm.Window({
    title: "Spinner Demo",
    width: 320,
    height: 480,
    align: FILL_BOTH,
    elements: {
        the_background: elm.Background({
            weight: EXPAND_BOTH,
            align: FILL_BOTH,
            resize: true,
        }),
        the_box: elm.Box({
            weight: EXPAND_BOTH,
            resize: true,
            elements: {
                the_spinner: elm.Spinner({
                    label_format: "%1.1f units",
                    step: 1.3,
                    wrap: 1,
                    min: -50.0,
                    max: 250.0,
                    style: "vertical",
                    disabled: false,
github kakaroto / e17 / PROTO / elev8 / data / javascript / genlist.js View on Github external
var other_class = {
   style: 'double_label',
   text: function(part) {
      return 'Other #' + this.data;
   },
   state: function(part) {
      return true;
   }
};

var win = elm.realise(elm.Window({
    title: "GenList Example",
    width: 320,
    height: 480,
    elements: {
        background: elm.Background({
            weight: EXPAND_BOTH,
            align: FILL_BOTH,
            resize: true,
        }),
        box: elm.Box({
            weight: EXPAND_BOTH,
            align: FILL_BOTH,
            resize: true,
            elements: {
                list: elm.Genlist({
                    weight: EXPAND_BOTH,
                    align: FILL_BOTH,
                    elements: {},
                    on_longpress: function(item) {
                        item.long_pressed = true;
                    },
github kakaroto / e17 / PROTO / elev8 / data / javascript / check.js View on Github external
var FILL_BOTH = { x: -1.0, y: -1.0 };

var logo_icon = elm.Icon({
    image: elm.datadir + "data/images/logo_small.png"
});

var logo_icon_unscaled = elm.Icon({
    image: elm.datadir + "data/images/logo_small.png",
    resizable_up: false,
    resizable_down: false
});

var w = elm.Window({
    title: "Check box demo",
    elements: {
        the_background: elm.Background({
            weight: EXPAND_BOTH,
            resize: true
        }),
        the_box: elm.Box({
            weight: EXPAND_BOTH,
            resize: true,
            elements: {
                icon_sized_check: elm.Check({
                    icon: logo_icon,
                    label: "Icon sized to check",
                    weight: { x: -1.0, y: -1.0 },
                    align: { x: -1.0, y: 0.5 },
                    state: true
                }),
                toggle1: elm.Check({
                    style: "toggle",