Another update from ingydotnet^djgoku
This commit is contained in:
parent
91df62d461
commit
948b86eafa
7604 changed files with 108452 additions and 22726 deletions
26
Task/Animation/Dart/animation.dart
Normal file
26
Task/Animation/Dart/animation.dart
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
import 'dart:html';
|
||||
import 'dart:async';
|
||||
|
||||
const frameTime = const Duration(milliseconds: 100);
|
||||
|
||||
void main() {
|
||||
String text = "Hello World! ";
|
||||
bool rotateRight = true;
|
||||
|
||||
Element writeHere =
|
||||
querySelector('#output'); // assumes you have a pre with that ID
|
||||
writeHere.onClick.listen((event) => rotateRight = !rotateRight);
|
||||
|
||||
new Timer.periodic(frameTime, (_) {
|
||||
text = changeText(text, rotateRight);
|
||||
writeHere.text = text;
|
||||
});
|
||||
}
|
||||
|
||||
String changeText(extt, rotateRight) {
|
||||
if (rotateRight) {
|
||||
return extt.substring(extt.length - 1) + extt.substring(0, extt.length - 1);
|
||||
} else {
|
||||
return extt.substring(1) + extt.substring(0, 1);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue