Exemplo n.º 1
0
 setTimeout(function(){
     self.handle = amino.native.createAnim(
         target.handle,
         name,
         self._from,self._to,self._duration);
     amino.native.updateAnimProperty(self.handle, 'count', self._loop);
     amino.native.updateAnimProperty(self.handle, 'lerpprop', 17); //17 is cubic in out
     amino.getCore().anims.push(self);
 },this._delay);
Exemplo n.º 2
0
 this.delayedAdd = function(app) {
     for(var i=0; i<this.apps.length; i++) {
         var ap = this.apps[i];
         if(i <= current) {
             var xoff = (i-current-1)*self.switcherPanel.getW();
             amino.getCore().createPropAnim(ap,'tx', ap.getTx(), self.switcherPanel.getW()/4+xoff/2, 200);
         }
     }
     setTimeout(function() {
        self.add(app);
     },250);
 }
Exemplo n.º 3
0
 this.add = function(app) {
     console.log('adding an app');
     this.root.add(app);
     this.apps.splice(current+1, 0, app);
     //this.core.on("drag",app,this.dragHandler);
     //this.core.on("release",app,this.releaseHandler);
     if(this.zoomedin) {
     } else {
         app.setTx(100).setScalex(0.5).setScaley(0.5);
         amino.getCore().createPropAnim(app,'ty',480, 80, 200);
     }
     current++;
 }
Exemplo n.º 4
0
if(typeof document == "undefined") {
    var amino = require('amino.js');
    var widgets= require('widgets.js'); 
}
amino.startApp(function(core, stage) {
    var group = new amino.ProtoGroup();
    //    var text = new amino.ProtoText().setTx(100).setTy(100).setText("foo").setFill("#33cc44").setFontSize(10);
    stage.setRoot(group);
    
    var button = new widgets.PushButton().setText("a button").setTx(50).setTy(50).setW(150).setH(30);
    group.add(button);
    
    
    var textfield = new widgets.TextField().setTx(50).setTy(100).setW(150).setH(30);
    group.add(textfield);

    var rect = new amino.ProtoRect().setW(10).setH(10).setFill("#33cc44");
    group.add(rect);
    core.on("move",null,function(e) {
        rect.setTx(e.x+1);
        rect.setTy(e.y+1);
    });
    
});
Exemplo n.º 5
0
amino.start(function(core, stage) {
    var root = new amino.Group();
    stage.setSize(400,400);
    stage.setRoot(root);

    function configure(m) {
        console.log("SLAVE: configuring",m);
        if(m.props.w) {
            stage.setSize(m.props.w,m.props.h);
        }
        if(m.props.dx) {
            root.x(m.props.dx);
        }
        if(m.props.dy) {
            root.y(m.props.dy);
        }
    }

    function make(m) {
        if(m.target == 'amino.Rect') {
            var obj = new amino.Rect();
            for(var name in m.props) {
                obj[name](m.props[name]);
            }
            root.add(obj);
        }
    }

    function find(root, id) {
        for(var i=0; i<root.children.length; i++) {
            var child = root.children[i];
            if(child.id() == id) {
                return child;
            }
        }
    }

    function update(m) {
        var obj = find(root,m.id);
        for(var name in m.props) {
            obj[name](m.props[name]);
        }
    }

    function anim(m) {
        var obj = find(root,m.id);
        var prop = obj[m.prop];
        var anim = prop.anim().from(m.anim.from).to(m.anim.to).dur(m.anim.dur).loop(m.anim.loop);
        anim.start();
    }

    process.on('message',function(m) {
        if(m.command == 'configure') {
            configure(m);
            return;
        }
        if(m.command == 'make') {
            make(m);
            return;
        }
        if(m.command == 'update') {
            update(m);
            return;
        }
        if(m.command == 'anim') {
            anim(m);
            return;
        }

        console.log("SLAVE: unknown command!",m);
    })
})
Exemplo n.º 6
0
var amino = require('amino.js');
var sp = require('./superprops');

amino.startApp(function(core, stage) {

    var root = new sp.Group();
    stage.setRoot(root);

    var circle = new sp.Circle().radius(50)
        .fill('#ffcccc').filled(true)
        .x(100).y(100);
    root.add(circle);
});
Exemplo n.º 7
0
var amino = require('amino.js');    
var widgets = require('widgets.js');


amino.startApp(function(core, stage) {
    stage.setSize(320,480);
    
    var text = new widgets.TextField();
    text.setW(300).setH(200).setTy(30);
    text.setWrapping(true);
//    text.setFontSize(30);
    text.setText('This is some very long text that we are going to read about today');
    
    stage.setRoot(text);
    
});
Exemplo n.º 8
0
amino.startApp(function(core, stage) {
    var g = new Group().id('g1');
    stage.setRoot(g);

    var r2 = new Rect().x(100).y(100).w(100).h(50).fill('#ff00ff').id('r2'); //purple rect
    g.add(r2);

    var adsr = new Adsr();
    r2.x.match(adsr.a);

    core.on('press', r2, function(e) {
        adsr.a(e.target.getTx());
    })
    core.on('drag', r2, function(e) {
        adsr.a(adsr.a()+e.dx);
    });

    var r3 = new Rect().x(100).y(300).w(50).h(50).fill("#00ff00").id('r3');
    g.add(r3);
    r3.x.anim().from(0).to(300).dur(3000).loop(5).then(function() {
        console.log("we are finished");
    }).start();

    g.add(new Text().fill("#ffffff").id("textid").text('some text').y(100));

    g.add(new Button().h(100).w(300).visible(true));
    /*
    //how could we add validators and formatters?

    //build a simple layout using binding?
    var gray = '#cccccc';
    var box = new Panel().w(300).h(300).fill(gray);
    var button = new Button().text('lower right');
    button.x.match(box.w).minus(button.w);
    button.y.match(box.h).minus(button.h);

    //CSS style selection
    root.select('rect').fill('#000000');
    root.select('.awesome').stroke('#ffdd44');
    root.select('#title').text('the title');
    */


    /*
    //simple RSS viewer
    var titles = [];// async init for the list of headlines.
    text.rx.anim().from(0).to(90).dur(1000)
    .then(function() {
        count = (count+1)%titles.length;
        this.text(titles[count]);
    })
    .thenAnim().from(90).to(0).dur(1000)
    .thenWait(5000)
    .repeat(-1);
    */

    /*
    //particles for galaxy
    var parts = [];
    fornums(0,1000).map(function(i) {
        return {
            radius: rand(0.0,0.9),
            angle:  rand(0,Math.PI*2),
            color:  Color.hue(rand(0,100)).toRGBString(),
            size:   rand(2,20),
        }
    });
    var sim = new ParticleSimulator(parts);
    sim.draw = function(gl) {
        //map the values to GL stuff
    }



    //photo slideshow
    var files = []; //scan dir for files
    var count = 0;
    var views = [];
    setInterval(function() {
        //cycle the views
        views.push(views.shift());

        //anim the first two views
        views[0].x.anim().from(0).to(-SCREEN_WIDTH).dur(1000);
        views[1].x.anim().from(SCREEN_WIDTH).to(0).dur(1000);
        //load the third view
        views[2].src(files[count]).on('load',function() {
            var scale = Math.min(SW/img3.w(), SH/img3.h());
            views[2].sx(scale).sy(scale);
        });
        count = (count+1)%files.length;
    },5000);



    //big countdown timer
    letter[0]
    */

});