begin process at 2010 02 10 11:05:26
  Trouver un code source :
 
dans
 
Accueil > 

Code

 > 

ActionScripts

 > SIMULATION ALTERNATEUR TRIPHASÉ

SIMULATION ALTERNATEUR TRIPHASÉ


 Information sur la source

Note :
6 / 10 - par 3 personnes
6,00 / 10

  • 1

  • 2

  • 3

  • 4

  • 5

  • 6

  • 7

  • 8

  • 9

  • 10
Catégorie :ActionScripts Niveau :Débutant Date de création :20/05/2005 Date de mise à jour :26/05/2005 20:35:22 Vu / téléchargé :11 951 / 700

Auteur : nightmareofworld

Ecrire un message privé
Site perso
Commentaire sur cette source (7)
Ajouter un commentaire et/ou une note

 Description

Ceci est un simulateur d'alternateur triphasé qui indique les etats des trois phases en fonction de la position du rotor.
Je appliquer toute se que vous m'avez dit et sa marche beaucoup mieux je vous en remerci.
Mais j'aimerai savoir si quelqu'1 sait coment tracer les sinusoides en meme temps que le rotor tourne.Et j'ai aussi un probleme avec le zero qui n'apparait pas.J'ai un probleme avec mes courbes il y en a qu'une seule qui marche.

Source

  • onClipEvent (load) {
  • _root.pixel1.visible = false;
  • _root.vitesse = 0.1;
  • _root.nbpixel1 = 0;
  • _root.nbpixel2 = 0;
  • _root.nbpixel3 = 0;
  • _root.alpha = 0;
  • _root.x1 = 0;
  • _root.y1 = 0;
  • }
  • onClipEvent (keyDown) {
  • if (Key.isDown(82)) {
  • gotoAndPlay(1);
  • }
  • if (Key.isDown(107)) {
  • _root.vitesse += 0.1;
  • } else if (Key.isDown(109)) {
  • _root.vitesse -= 0.1;
  • }
  • }
  • onClipEvent (enterFrame) {
  • _root.alpha += 1;
  • if (_root.alpha == 60) {
  • _root.x1 += 1;
  • _root.nbpixel1 += 1;
  • _root.nbpixel2 += 1;
  • _root.nbpixel3 += 1;
  • _root.alpha = 0;
  • _root.y1 = (Math.round(418+(80*(Math.sin(((2*Math.PI)/(360/(_rotation*60)))*_root.x1+(Math.PI/2))))));
  • _root.y2 = (Math.round(418+(80*(Math.sin(((2*Math.PI)/(360/(_rotation*60)))*_root.x1+(Math.PI/2)+(2*Math.PI/3))))));
  • _root.y3 = (Math.round(418+(80*(Math.sin(((2*Math.PI)/(360/(_rotation*60)))*_root.x1+(Math.PI/2)+(-2*Math.PI/3))))));
  • duplicateMovieClip(_root.pixel1, "pixel1"+_root.nbpixel1, _root.nbpixel1);
  • _root["pixel1"+_root.nbpixel1]._visible = true;
  • setProperty(_root["pixel1"+_root.nbpixel1], _x, (473+_root.x1));
  • setProperty(_root["pixel1"+_root.nbpixel1], _y, _root.y1);
  • duplicateMovieClip(_root.pixel2, "pixel2"+_root.nbpixel2, _root.nbpixel2);
  • _root["pixel2"+_root.nbpixel2]._visible = true;
  • setProperty(_root["pixel2"+_root.nbpixel2], _x, (473+_root.x1));
  • setProperty(_root["pixel2"+_root.nbpixel2], _y, _root.y2);
  • duplicateMovieClip(_root.pixel3, "pixel3"+_root.nbpixel3, _root.nbpixel3);
  • _root["pixel3"+_root.nbpixel3]._visible = true;
  • setProperty(_root["pixel3"+_root.nbpixel3], _x, (473+_root.x1));
  • setProperty(_root["pixel3"+_root.nbpixel3], _y, _root.y3);
  • }
  • if (_root.x1 == 327) {
  • _root.x1 = 0;
  • function killerClip() {
  • _root.i = 300;
  • for (k=0; k<i; k++) {
  • removeMovieClip(_root["pixel1"+k]);
  • removeMovieClip(_root["pixel2"+k]);
  • removeMovieClip(_root["pixel3"+k]);
  • }
  • }
  • }
  • _root.vitesse2 = (((60*_root.vitesse)*60)/360);
  • this._rotation += _root.vitesse;
  • _root.phase10._visible = _rotation<-90 or _rotation>90;
  • _root.phase11._visible = _rotation>-90 and _rotation<90;
  • _root.phase13._visible = _rotation == -90 or _rotation == 90;
  • _root.phase20._visible = _rotation<30 and _rotation>-150;
  • _root.phase21._visible = _rotation>30 or _rotation<-150;
  • _root.phase23._visible = _rotation == 30 or _rotation == -150;
  • _root.phase30._visible = _rotation<-30 or _rotation>150;
  • _root.phase31._visible = _rotation>-30 and _rotation<150;
  • _root.phase33._visible = _rotation == -30 or _rotation == 150;
  • }
onClipEvent (load) {
	_root.pixel1.visible = false;
	_root.vitesse = 0.1;
	_root.nbpixel1 = 0;
	_root.nbpixel2 = 0;
	_root.nbpixel3 = 0;
	_root.alpha = 0;
	_root.x1 = 0;
	_root.y1 = 0;
}
onClipEvent (keyDown) {
	if (Key.isDown(82)) {
		gotoAndPlay(1);
	}
	if (Key.isDown(107)) {
		_root.vitesse += 0.1;
	} else if (Key.isDown(109)) {
		_root.vitesse -= 0.1;
	}
}
onClipEvent (enterFrame) {
	_root.alpha += 1;
	if (_root.alpha == 60) {
		_root.x1 += 1;
		_root.nbpixel1 += 1;
		_root.nbpixel2 += 1;
		_root.nbpixel3 += 1;
		_root.alpha = 0;
		_root.y1 = (Math.round(418+(80*(Math.sin(((2*Math.PI)/(360/(_rotation*60)))*_root.x1+(Math.PI/2))))));
		_root.y2 = (Math.round(418+(80*(Math.sin(((2*Math.PI)/(360/(_rotation*60)))*_root.x1+(Math.PI/2)+(2*Math.PI/3))))));
		_root.y3 = (Math.round(418+(80*(Math.sin(((2*Math.PI)/(360/(_rotation*60)))*_root.x1+(Math.PI/2)+(-2*Math.PI/3))))));
		duplicateMovieClip(_root.pixel1, "pixel1"+_root.nbpixel1, _root.nbpixel1);
		_root["pixel1"+_root.nbpixel1]._visible = true;
		setProperty(_root["pixel1"+_root.nbpixel1], _x, (473+_root.x1));
		setProperty(_root["pixel1"+_root.nbpixel1], _y, _root.y1);
		duplicateMovieClip(_root.pixel2, "pixel2"+_root.nbpixel2, _root.nbpixel2);
		_root["pixel2"+_root.nbpixel2]._visible = true;
		setProperty(_root["pixel2"+_root.nbpixel2], _x, (473+_root.x1));
		setProperty(_root["pixel2"+_root.nbpixel2], _y, _root.y2);
		duplicateMovieClip(_root.pixel3, "pixel3"+_root.nbpixel3, _root.nbpixel3);
		_root["pixel3"+_root.nbpixel3]._visible = true;
		setProperty(_root["pixel3"+_root.nbpixel3], _x, (473+_root.x1));
		setProperty(_root["pixel3"+_root.nbpixel3], _y, _root.y3);
	}
	if (_root.x1 == 327) {
		_root.x1 = 0;
		function killerClip() {
			_root.i = 300;
			for (k=0; k<i; k++) {
				removeMovieClip(_root["pixel1"+k]);
				removeMovieClip(_root["pixel2"+k]);
				removeMovieClip(_root["pixel3"+k]);
			}
		}
	}
	_root.vitesse2 = (((60*_root.vitesse)*60)/360);
	this._rotation += _root.vitesse;
	_root.phase10._visible = _rotation<-90 or _rotation>90;
	_root.phase11._visible = _rotation>-90 and _rotation<90;
	_root.phase13._visible = _rotation == -90 or _rotation == 90;
	_root.phase20._visible = _rotation<30 and _rotation>-150;
	_root.phase21._visible = _rotation>30 or _rotation<-150;
	_root.phase23._visible = _rotation == 30 or _rotation == -150;
	_root.phase30._visible = _rotation<-30 or _rotation>150;
	_root.phase31._visible = _rotation>-30 and _rotation<150;
	_root.phase33._visible = _rotation == -30 or _rotation == 150;
}


 Fichier Zip

Les Membres Club peuvent télécharger directement un fichier contenu dans le zip sans télécharger le zip en entier !
  •   triphase

Télécharger le zip


 Historique

21 mai 2005 21:18:49 :
correction des problemes précédents grace a votre aide
22 mai 2005 21:04:52 :
ajout de la fonction duplkicate movieclip mais ne semble pas fonctionner
26 mai 2005 20:35:22 :
ajout du tracage des courbes mais il y en a qu'une qui apparait

 Sources de la même categorie

Source avec Zip NAVIGATION DANS UN FICHIER XML par inaden
Source avec Zip Source avec une capture TWSCROLLBAR, UNE CLASSE DE SCROLLBAR SIMPLE ET PRATIQUE À UT... par Twinspirit
Source avec Zip Source avec une capture REBOND DE BALLON AVEC TWEEN par habibcode
Source avec Zip DIAPORAMA AS2 par ahmedhrbdj
Source avec Zip EXAMPLES DE TWEENS AS2 par rajas

Commentaires et avis

Commentaire de nightmareofworld le 20/05/2005 21:30:58

precision phasex1 = etat negatif
phasex0 = etat positif
avec x soit 1 soit 2 soit 3

Commentaire de pegase31 le 20/05/2005 21:59:56 administrateur CS

interessant, mais pourquoi ne pas avoir fait le dessin des bobines en Vecto ? Ca t'aurais pas mal allégé le poids final de ton SWF.
Aussi, il serait mieux de passer ton animation en 12 img/sec, ça le rendra bien plus fluide.

Peg'

Commentaire de nightmareofworld le 21/05/2005 13:14:28

Mon animation est deja en 12img/s normalement

Commentaire de pegase31 le 21/05/2005 13:28:59 administrateur CS

excuse, je me suis mal exprimé : "en plus de 12 img/sec" ... désolé

Commentaire de top30 le 21/05/2005 20:34:17

Une serie de petit truc :
- Augmente ta rotation de 4.95, ca evite d'avoir trop rapidemente un 180 ou 360 "stoppant" l'effet...
- Stoke les calculs répétifs dans une variable en début de script, par exemples, "var rot = this._rotation*(Math.PI/180)", ou encore "var tierPI = Math.PI/3". C est une bonne habitude qui libère de la ressource...
- Utilise "_parent" et non "_root", cest plus facile à réutiliser. Exemple : "_parent.phase1 =...".
- Utilise le systeme de mesure de Flash les degrés...
- Affiche tes phases selon une fourchette et non une valeur exacte que tu n'obtiendra pas toujours à chaque rotation complète ( D'où ton problème )...
- Affiche tes clips directement par une interrogation retournant une Boolean. Exemple : "_parent.phase1._visible = _rotation > -60 && _rotation < 60."...
- Et enfin fait comme Pegasse te dit passe ton anim à au moins 50 images secondes. Elle demande pas de gros calculs...

Voilà...
[4/10]

Commentaire de nightmareofworld le 21/05/2005 21:24:36

Je aussi un probleme avec la vitesse j'aimerai qu'elle augmente ou diminue de 1 en 1 alors que la des fois elle augmente bizarrement (exemple de -1 elle passe a -6.325 quand je l'augmente)

Commentaire de SuperDevy le 22/05/2005 16:45:22

A 3600 tr/min, ça tourne plus ! (normal)

Les "or" et "and" sont déconseillée, utilises plutôt "||" et "&&".

 Ajouter un commentaire




Nos sponsors


Sondage...

Comparez les prix

CalendriCode

Février 2010
LMMJVSD
1234567
891011121314
15161718192021
22232425262728

Consulter la suite du CalendriCode

 
Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel (EBArtSoft), Merci à Vincent pour ses précieux conseils.
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés

Google Coop CodeS-SourceS Google Coop CodeS-SourceS
Temps d'éxécution de la page : 0,437 sec (3)

Nous contacter | Annoncer sur CodeS-SourceS | Mentions légales