Skip to content

Instantly share code, notes, and snippets.

Alberto Pacheco albertochiwas

View GitHub Profile
@albertochiwas
albertochiwas / objetos-animacion.js
Last active Sep 8, 2017
Usando arreglo de objetos para animaciones (ver 0.3)
View objetos-animacion.js
var av = new Avatar(0);
var mov = [ // coreografia
[ // paso 1
{scale:0.3, rotate:10, x:200, y:200},
{a:1,g:45}, {a:3,g:-43}, {a:5, g:5}
],
[ // paso 2
{scale:0.5, rotate:0, x:210, y:210},
{a:1,g:90}, {a:3,g:-88}, {a:5,g:10}
],
@albertochiwas
albertochiwas / ardilla-festejando.js
Last active Sep 7, 2017
Usando arreglos JS para animar en base a una coreografia (ver. 3)
View ardilla-festejando.js
var av = new Avatar(15);
var mov = [ // coreografia
[[200,230], [1,45], [3,-43], [5, 0]], // paso 1
[[200,220], [1,90], [3,-88], [5, 5]], // paso 2
[[200,210], [1,105], [3,-102], [5, 9]], // paso 3
[[200,200], [1,128], [3,-126], [5, 5]], // paso 4
];
var paso=0, inc=1, maxp=mov.length, pausa=false;
av.scale(0.8);
frameRate(12);
@albertochiwas
albertochiwas / ardilla-terminator-1.js
Last active Sep 1, 2017
Ejercicio: Animar personaje para que salude 5 veces http://podcast.itch.edu.mx/live-editor/
View ardilla-terminator-1.js
var av = new Avatar(2);
av.scale(0.75);
frameRate(35);
var draw = function() {
background(255, 255, 0);
av.setAngle(1, 60);
av.next(2); //av.rotate(2, 1);
println(av.getAngle(2));
if (mouseIsPressed) {
av.setAngle(5,round(random(26,34)));
@albertochiwas
albertochiwas / ardilla-1.js
Last active Aug 27, 2017
Uso de comandos del Avatar API
View ardilla-1.js
var av = new Avatar(2);
av.scale(0.5);
frameRate(35);
av.setLimit(1,-5,90); // rango de desplazamiento (angulo limite)
av.setNext(1,5); // velocidad
var draw = function() {
background(155, 125, 196);
if (mouseIsPressed) {
av.next(1,5); // av.rotare(1,5);
}
View SaludaArdillaNext.js
var av = new Avatar(1);
av.scale(0.8);
var draw = function() {
background(0,200,0);
if (av.getAngle(1) < 75) { av.next(1); }
av.next(2);
av.draw(200,200);
};
View TwoPuppets.js
var av=[new Avatar(12), new Avatar(20)];
var draw = function() {
background(200);
av[ round(random(0,1)) ].rotate(
round(random(0,9)),
random(-5,5));
av[0].draw(mouseX, 200);
av[1].draw(mouseY, 200);
};
@albertochiwas
albertochiwas / HiPhineas.js
Created May 31, 2017
Another approach to switch & count arm swing movements
View HiPhineas.js
var av = new Avatar(15);
av.scale(0.75);
var dir = true;
var c = 0;
var draw = function() {
if (c > 10) { return; }
background(0, 0, 0, 100);
av.draw(mouseX,mouseY);
if ( av.getAngle(1) < 75 ) {
av.rotate(1,2);
@albertochiwas
albertochiwas / ArdillaSaludando2017.js
Created May 31, 2017
Ejemplo final curso Live Coding UACH Mayo 2017
View ArdillaSaludando2017.js
var av = new Avatar(2);
var c1 = color(255, 0, 0);
var c2 = color(48, 60, 199);
var c = c1;
var ang = 1;
var mouseClicked = function() {
if ( c===c1 ) {
c = c2;
} else {
@albertochiwas
albertochiwas / anim-0.svg
Last active Feb 11, 2017
Animacion principal del logotipo CODE.org
View anim-0.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@albertochiwas
albertochiwas / search_box.html
Created Oct 15, 2016
Version derivada de Ivan para realizar busquedas
View search_box.html
<!doctype html>
<html lang="es">
<head>
<meta charset="UTF-8">
<title>Buscador</title>
</head>
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<script>
You can’t perform that action at this time.