Last active
September 29, 2018 02:46
-
-
Save HilmiZul/3b5d1ddd3887c5223200db2a2ef316e3 to your computer and use it in GitHub Desktop.
Animasi zoom in sederhana pada teks menggunakan p5.js
This file contains hidden or 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
| // required: p5.js | |
| // 29 September 2018, 9:09 A.M. | |
| // in sketch.js :D | |
| function Text() { | |
| // ukuran font default | |
| this.font_size = 10; | |
| // skala zoom in dilakukan 5x setiap melakukan zoom in | |
| this.zoom_step = 5; | |
| // menampilkan teks "Hello" | |
| this.show_teks = function() { | |
| fill(255); | |
| noStroke(); | |
| textSize(this.font_size); | |
| text("Hello", width/2, height/2); | |
| }; | |
| // fungsi utama untuk melakukan zoom in pada teks "Hello" | |
| // font_size (default) ditambahkan skala zoom in (zoom_step) setiap perulangan dilakukan. | |
| this.zoom = function() { | |
| this.font_size = this.font_size + this.zoom_step; | |
| }; | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment