Last active
August 29, 2015 14:09
-
-
Save giisyu/3f86d5ec60cadb1e6954 to your computer and use it in GitHub Desktop.
create a elastic bar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--example : http://www.share-elm.com/sprout/546cc30be4b00800031fee56 | |
elasticBar (x,y) baseSide extendSide maxValue angle barColor state = | |
let moveDis = min extendSide (extendSide * (state / maxValue )) | |
faring bcolor shape = shape|>filled bcolor|> move (x,y)|> rotate (degrees angle) | |
in [polygon [(0,0),(baseSide,0),(baseSide,extendSide),(0,extendSide)]|>faring gray, | |
polygon [(0,0),(baseSide,0),(baseSide,moveDis),(0,moveDis)]|>faring barColor ] | |
bar state = elasticBar (0,0) 10 200 10 270 blue (toFloat state) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment