EXHIBIT 10.4

                       DECLARATION OF REGISTRATION RIGHTS

            This DECLARATION OF REGISTRATION RIGHTS ("Declaration") is made as
of June 30, 1997, by Triangle Pharmaceuticals, Inc., a Delaware corporation
("Parent"), for the benefit of stockholders of Avid Corporation, a Pennsylvania
corporation ("Company"), acquiring shares of the Common Stock of Parent pursuant
to that certain Agreement and Plan of Reorganization dated as of June 30, 1997
(the "Reorganization Agreement"), among Parent, Company and Project Z
Corporation, a Delaware corporation and a wholly-owned subsidiary of Parent
("Sub").

            1. Definitions. As used in this Declaration:

                  a. "1934 Act" means the Securities Exchange Act of 1934, as
amended.

                  b. "Act" means the Securities Act of 1933, as amended.

                  c. "Form S-3" means such form under the Act as in effect on
the date hereof or any registration form under the Act subsequently adopted by
the SEC which similarly permits inclusion or incorporation of substantial
information by reference to other documents filed by Parent with the SEC.

                  d. "Holder" means a stockholder of Company to whom shares of
Registrable Securities are issued pursuant to the Reorganization Agreement.

                  e. "Majority Holders" means the Holders of a majority of the
Registrable Securities with rights existing under this Declaration.

                  f. "Registrable Securities" means for each Holder the number
of shares of Parent Common Stock issued to such Holder pursuant to the
Reorganization Agreement, and for all Holders the aggregate of all Registrable
Securities held by all such Holders, together with all other shares of Parent
Common Stock which may hereafter be issued with respect thereto as the result of
a stock split, stock dividend or otherwise; provided, however, that shares of
Parent Common Stock held by the Escrow Agent pursuant to Article VII of the
Reorganization Agreement shall not be deemed to be Registrable Securities unless
and until such shares are released to the Holders in accordance with the
provisions of Article VII of the Reorganization Agreement. Registrable
Securities shall not include any shares of Parent Common Stock transferred by a
Holder.

<PAGE>

                  g. "SEC" means the Securities and Exchange Commission.

            Capitalized terms not otherwise defined herein have the meanings
given to them in the Reorganization Agreement.

            2. Registration. If one of the conditions described in Section
1.6(b)(ii)(A) of the Reorganization Agreement is satisfied, Parent shall use its
commercially reasonable efforts to cause the Registrable Securities held by each
Holder following the Merger to be registered under the Act so as to permit the
resale thereof, and in connection therewith shall prepare and file a
registration statement on Form S-3 with the SEC within sixty (60) days following
Parent's receipt of the written request of the Majority Holders; provided,
however, that each Holder shall at the request of Parent provide to Parent all
such information and materials with respect to such Holder and take all such
action as may be reasonably required in order to permit Parent to comply with
all applicable requirements of the SEC with respect to such registration
statement and to obtain any desired acceleration of the effective date of such
registration statement, such provision of information and materials by each
Holder to be a condition precedent to the obligations of Parent pursuant to this
Declaration with respect to such Holder. The Majority Holders may not request
registration earlier than the second anniversary of the Closing Date nor later
than the fourth anniversary of the Closing Date. Parent shall not be required to
effect more than one (1) registration under this Declaration. The offering made
pursuant to such registration shall not be underwritten.

            3. Postponement of Registration. Notwithstanding Section 2 above,
Parent shall be entitled to postpone the declaration of effectiveness of the
registration statement prepared and filed pursuant to Section 2 for up to one
hundred eighty (180) calendar days, if the Board of Directors of Parent, acting
in good faith, determines that there exist business reasons for such
postponement; provided, however, that the Company may not postpone the
declaration of effectiveness of the registration statement pursuant to this
Section 3 more than once in any twelve-month period.

            4. Obligations of Parent. Subject to the limitations of Sections 3,
5 and 12, Parent shall (i) prepare and file with the SEC the registration
statement on Form S-3 in accordance with Section (2) hereof with respect to the
shares of Registrable Securities and shall use reasonable efforts to cause such
registration statement to become effective as promptly as practicable after
filing and to keep such registration statement effective for ninety (90)
calendar days (which period shall be extended by any period of time during which
the Holders are not permitted to resell their Registrable Securities under the
registration statement as a result of the provisions of Section 5 below or a
lock-up of the Registrable Securities pursuant to Section 5.1(e) of the
Reorganization Agreement); (ii) prepare and file with the SEC such amendments
and supplements to such registration statement and the prospectus used in
connection therewith as may be necessary to comply with the provisions of the
Act with respect to the resale or other disposition of all securities proposed
to be registered in such registration statement; (iii) furnish to each Holder
such number of copies of any prospectus (including any preliminary prospectus


                                       2
<PAGE>

and any amended or supplemented prospectus) in conformity with the requirements
of the Act, and such other documents, as each Holder may reasonably request in
order to effect the offering and resale of the shares of the Registrable
Securities to be offered and resold, but only while Parent shall be required
under the provisions hereof to cause the registration statement to remain
current; and (iv) use its commercially reasonable efforts to register or qualify
the shares of the Registrable Securities covered by such registration statement
under the securities or blue sky laws of such jurisdictions as each Holder shall
reasonably request (provided that Parent shall not be required in connection
therewith or as a condition thereto to qualify to do business or to file a
general consent to service of process in any such jurisdiction where it has not
been qualified).

            5. Selling Procedures. Any sale of Registrable Securities pursuant
to the registration statement filed in accordance with Section 2 hereof shall be
subject to the following conditions and procedures:

                  a. Stockholder Notice. Each selling Holder shall provide
written notice ("Stockholder Notice") to Parent no less than five (5) business
days prior to such Holder's intended sale. Within two (2) business days of
receipt of the Stockholder Notice, Parent will inform such Holder in writing if
the registration statement and final prospectus then on file with the SEC is
current and otherwise complies with the Act such that sales may be made
thereunder. After receipt of notice from Parent that the registration statement
is current and complies with the Act, such Holder shall then have ten (10)
business days after the date of the intended sale, as specified in the
Stockholder Notice, to sell the Registrable Securities proposed to be sold.
After such ten (10) day period, the selling Holder shall once again comply with
the procedures set forth in this Section 5(a) prior to any further sales.

                  b. Updating the Prospectus. If Parent informs the selling
Holders that the registration statement or final prospectus then on file with
the SEC is not current or otherwise does not comply with the Act, Parent shall
use commercially reasonable efforts to provide to the selling Holders a current
prospectus that complies with the Act on or before the date of the intended sale
of the Registrable Securities as disclosed in the Stockholder Notice; provided,
however, that no more than four (4) times during any twelve-month period, Parent
shall have the right to delay the preparation of a current prospectus that
complies with the Act for up to forty-five (45) days on each occasion without
explanation to such Holders.

                  c. Blackout Periods. No sale shall be made by any Holder
during the period commencing on the first calendar day of the third month of
each of Parent's fiscal quarters and ending forty-eight (48) hours after the
public release by Parent of financial results for such quarter.

                  d. General. Notwithstanding the foregoing, Parent shall notify
each Holder (i) of any request by the SEC or any other federal or state
governmental authority during the period of effectiveness of the registration
statement for amendments or supplements to the registration statement or related
prospectus or for additional information relating to the


                                       3
<PAGE>

registration statements, (ii) of the issuance by the SEC or any other federal or
state governmental authority of any stop order suspending the effectiveness of
the registration statement or the initiation of any proceedings for that
purpose, (iii) of the receipt by Parent of any notification with respect to the
suspension of the qualification or exemption from qualification of any of the
Registrable Securities for sale in any jurisdiction or the initiation or
threatening of any proceeding for such purpose, or (iv) of the happening of any
event which makes any statement made in the prospectus included in the
registration statement or any document incorporated or deemed to be incorporated
therein by reference untrue in any material respect or which requires the making
of any changes in the prospectus so that it will not contain an untrue statement
of a material fact or omit to state a material fact necessary in order to make
the statements therein, in the light of the circumstances under which they were
made, not misleading. In such event, Parent may suspend use of the prospectus on
written notice to each Holder, in which case each Holder shall not dispose of
Registrable Securities covered by the registration statement or prospectus until
copies of a supplemented or amended prospectus are distributed to the Holders or
until the Holders are advised in writing by Parent that the use of the
applicable prospectus may be resumed. Parent shall use its commercially
reasonable efforts to ensure that the use of the prospectus may be resumed as
soon as practicable. Parent shall use its commercially reasonable efforts to
obtain the withdrawal of any order suspending the effectiveness of the
registration statement, or the lifting of any suspension of the qualification
(or exemption from qualification) of any of the securities for sale in any
jurisdiction, at the earliest practicable moment. Parent shall, upon the
occurrence of any event contemplated by clause (iv), prepare a supplement or
post-effective amendment to the registration statement or a supplement to the
related prospectus or any document incorporated therein by reference or file any
other required document so that, as thereafter delivered to the purchasers of
the Registrable Securities being sold thereunder, such prospectus will not
contain an untrue statement of a material fact or omit to state a material fact
necessary to make the statements therein, in light of the circumstances under
which they were made, not misleading.

            6. Expenses. Parent shall pay all of the out-of-pocket expenses
incurred, other than selling discounts and commissions and the fees and
disbursements of counsel for any of the selling Holders, in connection with any
registration of Registrable Securities pursuant to this Declaration, including,
without limitation, all SEC, Nasdaq and blue sky registration and filing fees,
printing expenses, transfer agents' and registrars' fees, and the reasonable
fees and disbursements of Parent's outside counsel and independent accountants.

            7. Indemnification. In the event of any offering registered pursuant
to this Declaration:


                                       4
<PAGE>

                  a. Indemnification by Parent. Parent will indemnify each
Holder, each of its directors, officers, partners and its legal counsel and
independent accountants, and each person controlling such Holder within the
meaning of Section 15 of the Act, against all expenses, claims, losses, damages
and liabilities (or actions in respect thereof), including any of the foregoing
incurred in settlement of any litigation, commenced or threatened, arising out
of or based on any untrue statement (or alleged untrue statement) of a material
fact contained in any registration statement, final prospectus, or any amendment
or supplement thereto, incident to any offering registered pursuant to this
Declaration, or based on any omission (or alleged omission) to state therein a
material fact required to be stated therein or necessary to make the statements
therein, in light of the circumstances in which they are made, not misleading,
or any violation by Parent of any rule or regulation promulgated under the Act,
or state securities laws applicable to Parent in connection with any such
registration, and subject to Section 7(c), will reimburse each such Holder and
each person controlling such Holder, for any legal and any other out-of-pocket
expenses reasonably incurred in connection with investigating, preparing or
defending any such claim, loss, damage, liability or action, provided that
Parent will not be liable in any such case to the extent that any such claim,
loss, damage, liability or expense arises out of or is based on any untrue
statement or omission or alleged untrue statement or omission made in reliance
upon and in conformity with written information furnished to Parent by such
Holder or controlling person and stated to be specifically for use therein.

                  b. Indemnification by Holders. Each Holder will indemnify
Parent, each of its directors and officers and its legal counsel and independent
accountants, each person who controls Parent within the meaning of Section 15 of
the Act, and each other Holder and each person controlling such Holder within
the meaning of Section 15 of the Act, against all claims, losses, damages and
liabilities (or actions in respect thereof) arising out of or based on any
untrue statement (or alleged untrue statement) of a material fact contained in
any such registration statement, final prospectus, or any amendment or
supplement thereto, incident to any offering registered pursuant to this
Declaration, or any omission (or alleged omission) to state therein a material
fact required to be stated therein or necessary to make the statements therein
not misleading, and will reimburse Parent, such other Holders, such directors,
officers, legal counsel, independent accountants or control persons for any
legal or any other expenses reasonably incurred in connection with investigating
or defending any such claim, loss, damage, liability or action, in each case to
the extent, but only to the extent, that such untrue statement (or alleged
untrue statement) or omission (or alleged omission) is made in such registration
statement, final prospectus, or any amendment or supplement thereto, in reliance
upon and in conformity with written information furnished to Parent by such
Holder and stated to be specifically for use therein; provided, however, that
the obligations of such Holder hereunder shall be several and not joint and
shall be limited to an amount equal to the respective gross proceeds (before
expenses and commissions) from the sale of Registrable Securities by such Holder
as contemplated herein.

                  c. Indemnification Procedures. Each party entitled to
indemnification under this Section 7 (the "Indemnified Party") shall give notice
to the party required to provide


                                       5
<PAGE>

indemnification (the "Indemnifying Party") promptly after such Indemnified Party
has received written notice of any claim as to which indemnity may be sought,
and shall permit the Indemnifying Party to assume the defense of any such claim
or any litigation resulting therefrom, provided that counsel for the
Indemnifying Party, who shall conduct the defense of such claim or litigation,
shall be approved by the Indemnified Party (whose approval shall not be
unreasonably withheld), and the Indemnified Party may participate in such
defense at such party's expense, and provided further that the failure of any
Indemnified Party to give notice as provided herein shall not relieve the
Indemnifying Party of its obligations under this Declaration, except to the
extent, but only to the extent, that the Indemnifying Party's ability to defend
against such claim or litigation is impaired as a result of such failure to give
notice. Notwithstanding the foregoing sentence, the Indemnified Party may retain
its own counsel to conduct the defense of any such claim or litigation, and
shall be entitled to be reimbursed by the Indemnifying Party for expenses
incurred by the Indemnified Party in defense of such claim or litigation, in the
event that the Indemnifying Party does not assume the defense of such claim or
litigation within sixty days after the Indemnifying Party receives notice
thereof from the Indemnified Party. Further, an Indemnifying Party shall be
liable for amounts paid in settlement of any such claim or litigation only if
the Indemnifying Party consents in writing to such settlement (which consent
shall not be unreasonable withheld). No Indemnifying Party, in the defense of
any such claim or litigation, shall, except with the consent of each Indemnified
Party, consent to entry of any judgment or enter into any settlement which does
not include as an unconditional term thereof the giving by the claimant or
plaintiff to such Indemnified Party of a release from all liability in respect
to such claim or litigation.

                  d. Contribution. If the indemnification provided for in this
Section 7 is held by a court of competent jurisdiction to be unavailable to an
Indemnified Party due to operation of law with respect to any loss, liability,
claim or damage referred to therein, then the Indemnifying Party, to the extent
such indemnification is unavailable, in lieu of indemnifying such Indemnified
Party, shall contribute to the amount paid or payable by such Indemnified Party
as a result of such loss, liability, claim or damage in such proportion as is
appropriate to reflect the relative benefit to or fault of the Indemnifying
Party on the one hand and of the Indemnified Party on the other in connection
with the statements or omissions that resulted in such loss, liability, claim or
damage as well as any other relevant equitable considerations. The relative
benefit to the Indemnifying Party and of the Indemnified Party shall be
determined by reference to, among other things, the gross proceeds received by
each such party from the sale of the Registrable Securities in the manner
contemplated hereby. The relative fault of the Indemnifying Party and of the
Indemnified Party shall be determined by reference to, among other things,
whether the untrue or alleged untrue statement of a material fact of the
omission to sate a material fact relates to information supplied by the
Indemnifying Party or by the Indemnified Party and the parties' relative intent,
knowledge, access to information, and opportunity to correct or prevent such
statement or omission. The amount paid or payable by a party as a result of the
loss, liability, claim or damage referred to above shall be deemed to include
any legal or other fees or expenses reasonably incurred by such party in
connection with any investigation or proceeding. The parties hereto agree that
it would not be just and equitable


                                       6
<PAGE>

if contribution pursuant to this Section 7(d) were determined by pro rata
allocation or by any other method of allocation that does not take account of
the equitable considerations referred to above in this Section 7(d). No party
guilty of fraudulent misrepresentation (within the meaning of Section 11(f) of
the Act) shall be entitled to contribution from any party.

                  e. Survival of Obligations. The obligations of Parent and each
Holder under this Section 7 shall survive the completion of any offering of
stock in a registration statement under this Declaration.

            8. Reports Under Securities Exchange Act of 1934. Parent agrees to:

                  a. use its commercially reasonable efforts to file with the
SEC in a timely manner all reports and other documents required of Parent under
the Act and the 1934 Act; and

                  b. furnish to each Holder forthwith upon request (i) a written
statement by Parent that it has complied with the reporting requirements of the
Act and the 1934 Act, or that it qualifies as a registrant whose securities may
be resold pursuant to Form S-3 (at any time that it so qualifies), (ii) a copy
of the most recent annual or quarterly report of Parent and (iii) such other
information as may be reasonably requested in availing each Holder of any rule
or regulation of the SEC which permits the selling of any such securities
pursuant to Form S-3.

            9. No Assignment of Registration Rights. The rights of a Holder
pursuant to this Declaration to cause Parent to register Registrable Securities
may not be assigned or transferred, voluntarily or involuntarily, by a Holder.

            10. Amendment of Registration Rights. The Majority Holders may, with
the consent of Parent, amend the registration rights granted hereunder.

            11. Termination. The registration rights set forth in this
Declaration shall terminate with respect to a Holder (and the shares held by
such Holder shall cease to constitute Registrable Securities) upon the earlier
of (i) such time as all of the Registrable Securities then held by such Holder
can be sold by such Holder in a three-month period in accordance with Rule 144
under the Act and (ii) the fourth anniversary of the Closing Date.

            12. Obligations of Holders. By exercising any rights hereunder, each
Holder shall be deemed to assume all obligations of a Holder hereunder as though
such Holder were a signatory hereto. Parent may require Holders to execute an
instrument whereby such Holders expressly assume all obligations of Holders
hereunder as a condition precedent to any obligations of Parent hereunder.


                                       7