ID
Réalisation d’une affiche A3 reprenant les codes de l’art optique. Intégration de QR code a la réalisation afin de produire des sons lors du passage d’un scanneur de code barre sur l’affiche.import ddf.minim.*; import java.awt.*;Minim minim; String scannedCode = "";boolean imageDisplayed = false; int imageDisplayTime;int dotCount = 0; // Pour suivre le nombre de points affichés int lastDotChangeTime = 0; // Stocke le temps du dernier changement int dotChangeInterval = 500; // Intervalle de changement en millisecondes (500ms)HashMap<String, AudioPlayer> barcodeSounds = new HashMap<String, AudioPlayer>();void setup() { fullScreen(); minim = new Minim(this); // Charger les sons des codes-barres prédéfinis loadBarcodeSounds(); textAlign(CENTER); text("Prêt à scanner", width / 2, 50); }void loadBarcodeSounds() { String[] barcodes = {"OpOpopitiop", "Nomatterwhatwehear" ,"whateverweface", "Thislifeisamazingwhen", "ButintheUnderworld","yougreetitwithopenarms","wecanlightuptheworld","Nomattertheplace","Illbewaiting"}; for (String barcode : barcodes) { String fileName = "son_" + barcode + ".mp3"; // Nom du fichier sonore basé sur le code-barres try { AudioPlayer sound = minim.loadFile(fileName); if (sound != null) { barcodeSounds.put(barcode, sound); } } catch (Exception e) { println("Erreur lors du chargement : " + fileName); } } }void draw() { background(0); // Animation des points pour "Prêt à scanner" if (millis() - lastDotChangeTime >= dotChangeInterval) { dotCount = (dotCount + 1) % 4; // Alterne entre 0 et 3 points lastDotChangeTime = millis(); } text("Prêt à scanner" + getDots(), width / 2, height / 2); text(scannedCode, width / 2, height / 2 + 100); if (imageDisplayed) { text("Code-barres traité : " + scannedCode, width / 2, height - 50); } }String getDots() { String dots = ""; for (int i = 0; i < dotCount; i++) { dots += "."; } return dots; }void keyPressed() { println("Touche pressée: " + key); // Accepter les chiffres (0-9), lettres majuscules et minuscules (A-Z, a-z) et le caractère spécial '§' if ((key >= '0' && key <= '9') || (key >= 'A' && key <= 'Z') || (key >= 'a' && key <= 'z') || key == '§') { scannedCode += key; } // Si une touche de retour (Entrée) est pressée, traiter le code scanné if (key == '\n' || key == '\r') { println("Code scanné: " + scannedCode); // Vérifier si le code scanné est un des codes-barres prédéfinis if (barcodeSounds.containsKey(scannedCode)) { AudioPlayer sound = barcodeSounds.get(scannedCode); sound.rewind(); sound.play(); imageDisplayed = true; } else { text("Code-barres inconnu", width / 2, height / 2 + 150); } // Réinitialiser le code scanné après le traitement scannedCode = ""; } }
Motion Design
Modélisation 3D
Illustration
Identité visuelle
Édition
Programmation
stephane.laguerreuh@gmail.com
A propos
Copyright Sorakskullcat - Création du site web : Sorakskullcat