Autor Beitrag
NeoAngel
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Do 12.05.05 17:26 
Tagchen,

ich möchte ein Tag/Nacht-Schaubild programmieren, in dem eine Sonne von links nach rechts wandert und links wieder als Mond auftaucht und zum rechten Rand schleicht.
Ich würd gerne wissen, wie ich den Tageshintergrund (clblue) langsam zum Nachthintergrund (clblack) werden lasse, sodass, wenn der Mond erscheint, bereits alles schwarz ist. Kann mir dazu noch einer sagen, wie ich Endlosschleife und möglicherweise Neigungen einbaue?

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
procedure TForm1.Timer1Timer(Sender: TObject);
begin
Sonne.visible:=true;
Mond.visible:=false;
Exit1.visible:=true;
Exit2.visible:=false;
Sonne.left := Sonne.left +5;
if Sonne.left >= 900 then
begin
form1.color:=clblack;
Sonne.visible:=false;
Mond.visible:=true;
Exit1.visible:=false;
Exit2.visible:=true;
Mond.left := Mond.left +4;
end;
if Mond.left >= 900 then;
end;

end.


Mit liebem Gruss,
NA


Moderiert von user profile iconChristian S.: Topic aus Sonstiges verschoben am Do 12.05.2005 um 17:27
Tobias1
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 454

Win 98, XP Prof
D3 Prof, D2005 Prof
BeitragVerfasst: Do 12.05.05 18:05 
Schau dir mal den ColorDialog an setzte die Farbe auf blau (ganz oben) und ziehe den Pfeil ganz rechts langsam nach unten und schaue wie sich die Parameter blau rot Grün veränden.

_________________
Auch das schlechteste Buch hat seine gute Seite: die letzte. (John Osborne)
Tobias1
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 454

Win 98, XP Prof
D3 Prof, D2005 Prof
BeitragVerfasst: Do 12.05.05 18:13 
Zwischen clblack und clblue wird einfach nur der Blauanteil erhöht (Rot und grün =0) von clblue bis cl white wird der rot und der Grünanteil gleichermaßen erhöht (blau = 255)

_________________
Auch das schlechteste Buch hat seine gute Seite: die letzte. (John Osborne)
Tobias1
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 454

Win 98, XP Prof
D3 Prof, D2005 Prof
BeitragVerfasst: Do 12.05.05 18:16 
Eine Farbe kannst du auch so zuweisen
ausblenden Delphi-Quelltext
1:
form1.Color:=rgb(0,0,255);					

rgb(red,green,blue);
Nun musst du das nur noch in einen Timer etc packen und jedes Mal blue um eine bestimmte Zahl erhöhen.

_________________
Auch das schlechteste Buch hat seine gute Seite: die letzte. (John Osborne)
NeoAngel
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Do 12.05.05 19:58 
tut mir leid, mädels, ich versteh das nicht so ganz mit dem übergang.
wäre einer so lieb mir, den gesamten befehl für blau:=schwarz hinzuschreiben?

lieben gruss,
na
Tobias1
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 454

Win 98, XP Prof
D3 Prof, D2005 Prof
BeitragVerfasst: Do 12.05.05 20:03 
füge mal einen Timer ein, stelle interval 20 ein, doppelklicke auf den Timer und füg folgendes ein:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
var 
i:integer=255;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
i:=i-1;
form1.color:=rgb(0,0,i);
end;

_________________
Auch das schlechteste Buch hat seine gute Seite: die letzte. (John Osborne)
Fabian W.
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1766

Win 7
D7 PE
BeitragVerfasst: Do 12.05.05 20:24 
[Konj] Erkläer ihm doch den Code, was hat er davon wenn er was ins Prog macht, dass er net versteht. [/Konj]
Blackheart
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 164

ME
D3Prof.-D6Standard
BeitragVerfasst: Do 12.05.05 20:28 
Hell nach Dunkel wenn du Dunkel nach Hell willst + durch - ersetzen.

ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls;

type
  TForm1 = class(TForm)
    Timer1: TTimer;
    procedure Timer1Timer(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;
   i,j,k:integer;
implementation

{$R *.dfm}

procedure TForm1.Timer1Timer(Sender: TObject);
begin
  i:=i-1;
  j:=j-1;
  k:=k-1;
  Form1.color:=rgb(i,j,k);
end;
Tobias1
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 454

Win 98, XP Prof
D3 Prof, D2005 Prof
BeitragVerfasst: Do 12.05.05 20:29 
Die Farbe besteht aus 3 Werten am Computer Rot Grün Blau (und nicht anderst wie mache PH-Lehrer meinen :wink: )
Jetzt wird jedes Mal der Blauwert eins zurückgesetzt bis irgendwann schwarz bleibt.

_________________
Auch das schlechteste Buch hat seine gute Seite: die letzte. (John Osborne)
Tobias1
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 454

Win 98, XP Prof
D3 Prof, D2005 Prof
BeitragVerfasst: Do 12.05.05 20:32 
@ Blackheart:

Farbverlauf von clblue zu clblack

_________________
Auch das schlechteste Buch hat seine gute Seite: die letzte. (John Osborne)
Fabian W.
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1766

Win 7
D7 PE
BeitragVerfasst: Do 12.05.05 20:33 
Zitat:
und nicht anderst wie mache PH-Lehrer meinen :wink:


Genau, deshalb solllte das eigentlich die perfekt Lösung für dein Problem sein. *Schkleichwerbungmachüb*


//Edit: Satz entfernt


Zuletzt bearbeitet von Fabian W. am Sa 14.05.05 07:08, insgesamt 1-mal bearbeitet
NeoAngel
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Do 12.05.05 21:11 
eine fiiiiiiinnnstere quelle hat mir gerade
form1.color:=form1.color-65536
zugeflüstert.

:dance2: KLAPPT!!! :dance2:
Fabian W.
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1766

Win 7
D7 PE
BeitragVerfasst: Do 12.05.05 21:14 
na also, passt doch!