Giter Club home page Giter Club logo

animate's Introduction

animate

Demo

var Controller = require('src/Controller');
var elements = [
    {
        id: 'bg',
        source: {
            width: 660,
            height: 112,
            elements: [
                {
                    type: 'img',
                    source: 'http://cdn.qplus.com/huayang/mgift/999/img/bg.png',
                    left: 0,
                    bottom: 0
                },
                {
                    type: 'text',
                    text: 'hello world',
                    fontSize: 30,
                    fontFamily: '-apple-system-font,"Helvetica Neue",Helvetica,STHeiTi,sans-serif',
                    color: '#fff',
                    relative: [145, 36],
                    relativeSize: [240, 36]
                }
            ]
        },
        scope: [215, 320],
        xy: {
            215: [1056, 677],
            220: [326, 677],
            223: [366, 677],
            225: [356, 677],
            315: [356, 677],
            320: [356, 777]
        },
        opacity: {
            215: 1,
            220: 100,
            315: 100,
            320: 2
        },
        scale: {
            215: 100,
            320: 100
        }
    },
    {
        source: 'http://cdn.qplus.com/huayang/mgift/99/img/0.png',
        cloneSource: true,
        fixX: 300,
        xy: {
            259: [124, 397],
            269: [124, 612],
            274: [84, 562],
            284: [84, 812]
        },
        opacity: {
            259: 1,
            269: 100,
            280: 100,
            284: 0
        }
    },
    {
        source: '<div>xxx</div>',
        depSource: [
            '//www.baidu.com/img/bd_logo1.png'
        ],
        style: {
            opacity: 1
        },
        tick: function(index) {
            console.log(this);
            console.log(index);
        }
    }
];

var controller = new Controller(
    {
        root: document.body,
        elements: elements
    }, 
    {
        fixX: -326,
        fixY: -397
    }
);

播放动画:

controller
    .on('create', function() {
        controller.start();
    });

查看某一帧:

controller
    .on('create', function() {
        controller.showFrameAt(58);
    });

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.