Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
file : elm.datadir + "data/images/plane3.png",
width : 50,
height : 70,
x : 500,
y : 250,
on_click : function() {
if(myplane==null)
{
print(this.height + " " + this.weight);
myplane = my_win.elements.plane3;
init();
}
},
on_animate : choose_plane,
}),
plane4 : elm.Image ({
file : elm.datadir + "data/images/plane4.png",
width : 50,
height : 70,
x : 350,
y : 400,
on_click : function() {
print("On Click Triggered");
if(myplane==null)
{
print(this.height + " " + this.weight);
myplane = my_win.elements.plane4;
init();
}
},
on_animate : choose_plane,
}),
}
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 ;
init();
}
},
on_animate : choose_plane,
}),
plane2 : elm.Image ({
file : elm.datadir + "data/images/plane2.png",
width : 50,
height : 70,
x : 200,
y : 250,
on_click : function() {
if(myplane==null)
{
print(this.height + " " + this.weight);
myplane = my_win.elements.plane2;
init();
}
},
on_animate : choose_plane,
}),
plane3 : elm.Image ({
file : elm.datadir + "data/images/plane3.png",
width : 50,
height : 70,
x : 500,
y : 250,
on_click : function() {
if(myplane==null)
{
print(this.height + " " + this.weight);
myplane = my_win.elements.plane3;
init();
}
},
on_animate : choose_plane,
}),
plane4 : 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 ;
init();
}
},
on_animate : choose_plane,
}),
plane2 : elm.Image ({
file : elm.datadir + "data/images/plane2.png",
width : 50,
height : 70,
x : 200,
y : 250,
on_click : function() {
if(myplane==null)
{
print(this.height + " " + this.weight);
myplane = my_win.elements.plane2;
init();
}
},
on_animate : choose_plane,
}),
plane3 : elm.Image ({
function sprite(n, type) {
return elm.Image({
width: 64,
height: 64,
file: elm.datadir + 'data/images/bubble_' + type + '.png',
on_animate: function(arg) {
animator(arg, n, type == 'sh');
}
});
}
var elm = require('elm');
var EXPAND_BOTH = { x : 1.0, y : 1.0 };
var EXPAND_X = { x : 1.0, y : 0.0 };
var EXPAND_Y = { x : 0.0, y : 1.0 };
var FILL_BOTH = { x : -1.0, y : -1.0 };
var FILL_X = { x : -1.0, y : 0.0 };
var FILL_Y = { x : 0.0, y : -1.0 };
var myplane=null;
var num_planes = 4;
var alien = elm.Image ({
file : elm.datadir + "data/images/alien.png",
width : 30,
height : 40,
x : 10,
y : 10,
});
function move_up()
{
myplane.y-=10;
if(myplane.y<10)
myplane.y=500;
}
function move_down()
{
myplane.y+=10;
var elm = require('elm');
var EXPAND_BOTH = { x : 1.0, y : 1.0 };
var my_window = elm.realise(elm.Window({
label: "Elev8 demo",
width: 1024,
height: 768,
elements : {
background : elm.Background({
weight: EXPAND_BOTH,
image: "fond.jpg",
resize: true,
}),
bubble : elm.Image({
width: 64,
height: 64,
file: "bubble.png",
dx: +2,
dy: -3,
on_animate : function (obj) {
var x, y;
x = obj.x + obj.dx;
y = obj.y + obj.dy;
if (x + obj.width > my_window.width || x < 0)
{
obj.dx = -obj.dx;
x += 2 * obj.dx;
}