Skip to content

Instantly share code, notes, and snippets.

View albertochiwas's full-sized avatar

Alberto Pacheco albertochiwas

View GitHub Profile
@albertochiwas
albertochiwas / covid-top20.py
Last active July 8, 2020 06:28
Report total deaths by COVID-19 by country (TOP 10) using this dataset: https://covid.ourworldindata.org/data/owid-covid-data.json
'''
Python for Everybody / Dr. Chuck / Univ Michigan / Coursera
Course 5: "Capstone: Retrieving, Processing, and Visualizing Data with Python"
covid-top20.py:
Read COVID-19 JSON dataset
Add to a list the total deaths, name & date for each country
Finally, sort and report the Top 20 COVID-19 countries
@albertochiwas
albertochiwas / objetos-animacion.js
Last active September 8, 2017 01:43
Usando arreglo de objetos para animaciones (ver 0.3)
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 September 7, 2017 05:09
Usando arreglos JS para animar en base a una coreografia (ver. 3)
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 September 1, 2017 05:21
Ejercicio: Animar personaje para que salude 5 veces http://podcast.itch.edu.mx/live-editor/
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 August 27, 2017 04:07
Uso de comandos del Avatar API
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);
}
@albertochiwas
albertochiwas / SaludaArdillaNext.js
Created June 1, 2017 01:48
Ardilla saludando (next)
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);
};
@albertochiwas
albertochiwas / TwoPuppets.js
Created May 31, 2017 02:46
LACLO paper example
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 02:22
Another approach to switch & count arm swing movements
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 02:10
Ejemplo final curso Live Coding UACH Mayo 2017
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 February 11, 2017 20:54
Animacion principal del logotipo CODE.org
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.