All Projects → mdgriffith → Elm Style Animation

mdgriffith / Elm Style Animation

Licence: bsd-3-clause
The style animation library for Elm!

Programming Languages

elm
856 projects

Projects that are alternatives of or similar to Elm Style Animation

Spring Boot In Action
Spring Boot 系列实战合集
Stars: ✭ 4,153 (+822.89%)
Mutual labels:  spring
Geek Programming Books
Free programing ebooks
Stars: ✭ 412 (-8.44%)
Mutual labels:  spring
Learn
How do you achieve your career objectives? Complete career paths with amazing Cloud, Full Stack and Microservice Courses and Videos from in28Minutes
Stars: ✭ 447 (-0.67%)
Mutual labels:  spring
Bouncylayout
Make. It. Bounce.
Stars: ✭ 4,035 (+796.67%)
Mutual labels:  spring
Spring Security Tutorial
Spring Security Tutorial takes you to learn Spring Security step by step with a large number of samples. Spring Security Tutorial 是一本关于 Spring Security 学习的开源书。利用业余时间写了本书,图文并茂,用大量实例带你一步一步走进 Spring Security 的世界。
Stars: ✭ 409 (-9.11%)
Mutual labels:  spring
Forest
基于netty轻量的高性能分布式RPC服务框架
Stars: ✭ 420 (-6.67%)
Mutual labels:  spring
Ms Backend Boilerplates
Boilerplate for Your Server Side(Backend) Application, Java | Spring(Boot, Cloud) | Node.js(Express, Koa, Egg) | Go | Python | DevOps 💫 服务端项目模板
Stars: ✭ 394 (-12.44%)
Mutual labels:  spring
Jeecg Boot
「企业级低代码平台」前后端分离架构SpringBoot 2.x,SpringCloud,Ant Design&Vue,Mybatis-plus,Shiro,JWT。强大的代码生成器让前后端代码一键生成,无需写任何代码! 引领新的开发模式OnlineCoding->代码生成->手工MERGE,帮助Java项目解决70%重复工作,让开发更关注业务,既能快速提高效率,帮助公司节省成本,同时又不失灵活性。
Stars: ✭ 26,432 (+5773.78%)
Mutual labels:  spring
Tutorial
Java全栈知识架构体系总结
Stars: ✭ 407 (-9.56%)
Mutual labels:  spring
Spring Tutorial
📖 Spring Framework 教程
Stars: ✭ 423 (-6%)
Mutual labels:  spring
Trashemail
A hosted disposable email telegram bot; Extremely privacy friendly; Proudly hosted for community.
Stars: ✭ 408 (-9.33%)
Mutual labels:  spring
Forum
一个简单的论坛项目,开发IDE为IntelliJ IDEA,通过Maven构建,后台采用Spring、SpringMVC、MyBatis,数据库采用MySQL、Redis,前台用到jQuery,图片被上传到七牛云。
Stars: ✭ 407 (-9.56%)
Mutual labels:  spring
Watchdog Framework
🍻 「停止维护」基于SpringBoot+Shiro+Mybatis等开发的轻量级管理系统快速开发脚手架
Stars: ✭ 421 (-6.44%)
Mutual labels:  spring
Spring Boot Tutorial
Spring Boot Tutorial takes you to learn Spring Boot step by step with a large number of samples.Spring Boot Tutorial 是一本关于 Spring Boot 学习的开源书。用大量实例带你一步一步走进 Spring Boot 的世界。
Stars: ✭ 399 (-11.33%)
Mutual labels:  spring
Java Sourcecode Blogs
Java源码分析 【源码笔记】专注于Java后端系列框架的源码分析,每周持续推出Java后端系列框架的源码分析文章。
Stars: ✭ 448 (-0.44%)
Mutual labels:  spring
Spring Boot Angular2
spring boot backend, angular2 frontend with webpack, typescript, sass, bootstrap4, karma, jasmine
Stars: ✭ 396 (-12%)
Mutual labels:  spring
Codeguide
📚 本代码库是作者小傅哥多年从事一线互联网 Java 开发的学习历程技术汇总,旨在为大家提供一个清晰详细的学习教程,侧重点更倾向编写Java核心内容。如果本仓库能为您提供帮助,请给予支持(关注、点赞、分享)!
Stars: ✭ 6,750 (+1400%)
Mutual labels:  spring
Spring Boot Demo
该项目已成功集成 actuator(监控)、admin(可视化监控)、logback(日志)、aopLog(通过AOP记录web请求日志)、统一异常处理(json级别和页面级别)、freemarker(模板引擎)、thymeleaf(模板引擎)、Beetl(模板引擎)、Enjoy(模板引擎)、JdbcTemplate(通用JDBC操作数据库)、JPA(强大的ORM框架)、mybatis(强大的ORM框架)、通用Mapper(快速操作Mybatis)、PageHelper(通用的Mybatis分页插件)、mybatis-plus(快速操作Mybatis)、BeetlSQL(强大的ORM框架)、upload(本地文件上传和七牛云文件上传)、redis(缓存)、ehcache(缓存)、ema…
Stars: ✭ 24,265 (+5292.22%)
Mutual labels:  spring
Tobetopjavaer
To Be Top Javaer - Java工程师成神之路
Stars: ✭ 22,056 (+4801.33%)
Mutual labels:  spring
Framework Learning
计算机学习资料(Java , Jvm , Linux , Mysql , Netty , Redis , Netty , Spring , SpringBoot , Mybatis , Rabbitmq ,计算机网络 , 数据结构与算法 , 设计模式 )Github网页阅读:https://guang19.github.io/framework-learning , Gitee网页版阅读: https://qsjzwithguang19forever.gitee.io/framework-learning
Stars: ✭ 416 (-7.56%)
Mutual labels:  spring

The Style Animation library for Elm!

The Basics

To get started, there are a few things that need to happen.

Set an initial style in your model.

import Animation exposing (px)

init : Model
init =
    { style = 
        Animation.style
            [ Animation.left (px 0.0)
            , Animation.opacity 1.0
            ]
    }

Subscribe to Animation's subscription. This will animate using AnimationFrame when something is running, and stop giving updates when there is no animation.

subscriptions : Model -> Sub Msg
subscriptions model =
    Animation.subscription Animate [ model.style ]

Set up an update Msg in your update function.

    Animate animMsg ->
        { model
            | style = Animation.update animMsg model.style
        }

Render our animation at the necessary element in your view. Not all animated properties are style properties(such as the svg.d property and polygon.points property), so Animation.render actually returns a list of Html.Attributes. Fortunately, you can add your own style because Html.Attributes.style stacks!

    div
        (List.concat
            [ Animation.render model.style
            , [ style
                    [ ( "position", "absolute" )
                    , ( "border-style", "dotted" )
                    ]
               ]
            ]
        )
        [ text "This is being Animated!" ]

Start an animation in your update statement.

case msg of
    Show ->
        let 
            newStyle = 
                Animation.interrupt
                    [ Animation.to 
                        [ Animation.left (px 0.0)
                        , Animation.opacity 1.0
                        ]
                    ]
                    model.style
        in
            { model
                | style = newStyle
            }

Here's generally how we compose animations.

  • Choose Animation.queue or Animation.interrupt, both of which take a list of steps and your animation model. This describes what the strategy should be if the thing you're trying to animate is already in the process of being animated. You either want to interrupt what its doing and do this new animation. Or you want to queue up this new animation to run after the current animation is finished. 90% of the time you want Animation.interrupt
  • Steps can be
    • Animation.to - Animate to a target style
    • Animation.set - Set a animation to a style immediately.
    • Animation.wait (5 * second) - wait for some amount of time
    • Animation.repeat x [..list of steps to repeat] - Repeat a list of steps x times.
    • Animation.loop [..list of steps to repeat] - Loop a list of steps forever/until interrupted.

Examples

Advanced!

Note!

The compiler is going to refer to your animation model as Animation.Model.Animation msg. Animation.State is just a synonym for that.

Sending Messages

  • Send Messages Example - Code

First, import Animation.Messenger

Change your Animation.State to Animation.Messenger.State MyMsgType.

You can now use Animation.Messenger.send MyCustomMessage as a step in composing your animation.

You need to update this new animation state using Animation.Messenger.update, which will return (newAnimState, messagesSentinCmdForm). So you need to change your animation update section to something like the following.

case msg of
    Animate animMsg ->
        let
            (newStyle, cmds) =
                Animation.Messenger.update
                    animMsg
                    model.style
        in
            ( { model
                 | style = newStyle
              },
              cmds
            )

Note! Make sure you're sending the cmds in the above code. If you're note, then the animation will run, but the messages won't be sent.

Also, if you're running this in a child component, make sure you're Cmd.maping the child's commands back to the child or else the messages will be lost!

Animating Properties that aren't directly supported.

You can construct custom properties if you don't find them in the library using Animation.custom. These will be rendered in the style property.

Animation.to
    [ Animation.custom "my-custom-prop" 5 "px"
    ]

There is also customColor for color based properties.

Setting Custom Interpolation

Behind the curtain elm-style-animation mostly uses springs to animate values from A to B. However you can specify custom values for a spring, or a duration and easing if you want. There are two basic ways to do this.

Set them with your initial style.

Use Animation.styleWith or Animation.styleWithEach to set your initial style instead of Animation.style.

Animation.styleWith
    (Animation.spring
        { stiffness = 400
        , damping = 23 }
    )
    [ Animation.opacity 0
    , Animation.left (px 20)
    ]

This will set the spring used for these properties. Alternatively Animation.styleWithEach is a way to set a custom interpolation for each individual property.

Set a temporary spring/duration + easing

You can also use Animation.toWith and Animation.toWithEach. These can be substituted for Animation.to and allow you to specify a spring or duration+easing that lasts for exactly one step. After that step, whatever default spring or duration/easing there is (either the auto default or via being specified in Animation.styleWith) is then used.

Animation.interrupt
    [ Animation.toWith
        (Animation.easing
            { duration = 2*second
            , ease = (\x -> x^2)
            }
        ) 
        [ Animation.left (px 0.0)
        , Animation.opacity 1.0
        ]
    ]
    model.style
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].