Invité Invité | Sujet: Cube 3D Sam 15 Oct 2011 - 14:01 | | | Cube 3D Apprendre à faire un cube 3D qui bouge avec votre souris, ça vous dit ? [Vous devez être inscrit et connecté pour voir ce lien]Allons-y ! 1. Dans ton logiciel de graphisme, fait 6 images différentes de 150 par 150 pixels qui serviront de face à ton cube. Pense à faire une bordure mince à chacune de tes images; cela fera un plus bel effet sur ton cube. Nomme-les: image0 image1 image2 image3 image4 image5 Note: Si tu y écris du texte sur tes images, il faut que ton image soit renversée comme dans un miroir pour qu'il soit visible sur ton cube en flash. Dans Paint Shop Pro, écris ton texte et fait Image / Miroir . Dans photofiltre studio c'est: Image / Transformation / Symétrie horizontal / Fond 2. Dans ton logiciel de flash, ouvre un nouveau document flash et mets la Taille de ton document à 300 par 300 pixels. [Vous devez être inscrit et connecté pour voir ce lien]3. Importe dans la bibliothèque tes 6 images. Fichier / Importer / Importer dans la bibilothèque. Ne PAS glisser ses images sur le plan de travail. 3. Sur ton image0 dans la bibliothèque, fais un clic droit et clique sur Liaison. [Vous devez être inscrit et connecté pour voir ce lien]4. Coche Exporter pour Action script. Dans l'Identifiant, écrit image0 (Enlève le point et le format de l'image (.jpg, ou .png) sinon ça ne fonctionnera pas). [Vous devez être inscrit et connecté pour voir ce lien]5. Refais l'étape 3 et 4 pour chacune de tes images dans la bibliothèque; écris: image1 pour ta deuxième, image2 pour ta troisième, image3 pour ta quatrième, image4 pour ta cinquième, image5 pour ta sixième. 6. Dans ta fenêtre Action (F9 si elle n'est pas ouverte), colle ce script: ==================================================================== Code: - Code:
-
function createImages() { var _loc1 = 6; while (_loc1--) { theScene.createEmptyMovieClip("image" + _loc1, _loc1); theScene["image" + _loc1].createEmptyMovieClip("contents", _loc1); theScene["image" + _loc1].contents.attachBitmap(flash.display.BitmapData.loadBitmap("image" + _loc1), 1, false, true); } } function pointsTransform(points, rotations) { var _loc17 = new Array(); var _loc10 = Math.sin(rotations.x); var _loc12 = Math.cos(rotations.x); var _loc8 = Math.sin(rotations.y); var _loc11 = Math.cos(rotations.y); var _loc7 = Math.sin(rotations.z); var _loc9 = Math.cos(rotations.z); var _loc16; var _loc15; var _loc3; var _loc5; var _loc4; var _loc6; var _loc18; var _loc14; var _loc13; var _loc1 = points.length; while (_loc1--) { _loc16 = points[_loc1].x; _loc15 = points[_loc1].y; _loc3 = points[_loc1].z; _loc5 = _loc12 * _loc15 - _loc10 * _loc3; _loc4 = _loc10 * _loc15 + _loc12 * _loc3; _loc18 = _loc11 * _loc4 - _loc8 * _loc16; _loc6 = _loc8 * _loc4 + _loc11 * _loc16; _loc14 = _loc9 * _loc6 - _loc7 * _loc5; _loc13 = _loc7 * _loc6 + _loc9 * _loc5; _loc17[_loc1] = {x: _loc14, y: _loc13}; } return (_loc17); } function movieClip3PointTransform(mc, a, b, c) { mc._visible = pointsIsVisible(a, b, c); if (!mc._visible) { return; } var _loc1 = mc.transform.matrix; _loc1.tx = b.x; _loc1.ty = b.y; _loc1.a = (a.x - b.x) / mc.contents._width; _loc1.b = (a.y - b.y) / mc.contents._width; _loc1.c = (c.x - b.x) / mc.contents._height; _loc1.d = (c.y - b.y) / mc.contents._height; mc.transform.matrix = _loc1; } function pointsIsVisible(a, b, c) { var _loc5 = b.x - a.x; if (!_loc5) { return (a.y > b.y == c.x > a.x); } var _loc4 = c.x - a.x; if (!_loc4) { return (a.y > c.y == b.x < a.x); } return ((b.y - a.y) / _loc5 < (c.y - a.y) / _loc4 != (a.x < b.x == a.x > c.x)); } Stage.scaleMode = "noScale"; var rotations = {x: 0, y: 0, z: 0}; var boxPoints = [{x: -75, y: -75, z: -75}, {x: 75, y: 75, z: -75}, {x: -75, y: 75, z: -75}, {x: -75, y: -75, z: 75}, {x: 75, y: -75, z: 75}, {x: 75, y: 75, z: 75}]; this.createEmptyMovieClip("theScene", 1); theScene._x = theScene._y = 150; createImages(); theScene.onEnterFrame = function () { rotations.x = rotations.x - this._ymouse / 3000; rotations.y = rotations.y + this._xmouse / 2000; var _loc2 = pointsTransform(boxPoints, rotations); movieClip3PointTransform(this.image0, _loc2[2], _loc2[0], _loc2[3]); movieClip3PointTransform(this.image1, _loc2[5], _loc2[1], _loc2[2]); movieClip3PointTransform(this.image2, _loc2[0], _loc2[2], _loc2[1]); movieClip3PointTransform(this.image3, _loc2[4], _loc2[3], _loc2[0]); movieClip3PointTransform(this.image4, _loc2[3], _loc2[4], _loc2[5]); movieClip3PointTransform(this.image5, _loc2[1], _loc2[5], _loc2[4]); }; ==================================================================================== 7. Teste ton animation: Contrôle / Tester l'animation. 8. Ajoute un nouveau calque et signe ta création à l'aide de l'outil texte. Signe-la en bas du plan de travail. De cette façon, ta signature se verra malgré le cube qui tourne. Ou pour ceux qui préfèrent, on peut mettre simplement un copyright ou mettre les deux (copyright et signature en prenant soin d'ajouter un nouveau calque dans le scénario). 9. Enregistre ton travail: Fichier / Exporter / Exporter l'animation. Qualité JPEG à 80. | |
Michel Elèves Flash Date d'inscription : 22/11/2011 | Sujet: Re: Cube 3D Mer 21 Déc 2011 - 17:45 | | | L'exercise du Michou [Vous devez être inscrit et connecté pour voir ce lien] :bisous2: | |
Invité Invité | Sujet: Re: Cube 3D Mer 21 Déc 2011 - 18:00 | | | parfait, mais il manque ton copyright , si tu ne sais pas le mettre je peus t'aider. évite de mettre du texte dans ton cube , voir "note" dans le tuto | |
Michel Elèves Flash Date d'inscription : 22/11/2011 | Sujet: Re: Cube 3D Mer 21 Déc 2011 - 21:08 | | | zephylyne, pour tes judicieux conseils Pour les signatures , oui tu as raison , elles sont à l'envers :bisous2: | |
katia66 fondatrice Date d'inscription : 17/05/2010 | Sujet: Re: Cube 3D Jeu 22 Déc 2011 - 8:54 | | | bravo michel, si ca t'interresse il y des cours de flash sur le forum
et en parlant de cours ceux de devilia, ca y est c'est arrangé pour de bon c'est fois j'ai trouvée le problème.
gros bisous | |
joee Graphiste Date d'inscription : 07/09/2012 | Sujet: Re: Cube 3D Dim 21 Oct 2012 - 17:17 | | | il faut faire 6 images de 150 sur 150 . mette le code et mette un code avex sont site ou forum . | |
katia66 fondatrice Date d'inscription : 17/05/2010 | Sujet: Re: Cube 3D Dim 21 Oct 2012 - 20:01 | | | bravo superbe bisous | |